{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "google_driver.ipynb",
      "version": "0.3.2",
      "provenance": [],
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/wx-chevalier/AIDL-Workbench/blob/master/apps/colab/google_driver.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "38kpxgRVl7hS",
        "colab_type": "code",
        "outputId": "aa6fa1cb-969e-4db2-bec1-99c0494dd006",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "# List files from current working directory\n",
        "!ls"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "sample_data\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "BnvwQt8AmFpi",
        "colab_type": "code",
        "outputId": "2e35c9bb-2348-460f-85df-f1df76d359fe",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 156
        }
      },
      "source": [
        "from google.colab import drive\n",
        "drive.mount(\"/content/drive\")\n",
        "\n",
        "print('Files in Drive:')\n",
        "!ls /content/drive/'My Drive'\n",
        "# Newly created drive folder is now lying besides other folders that you might create during this session on this virtual machine. After 12 hours it will all become a pumpkin be deleted."
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdocs.test%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.photos.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fpeopleapi.readonly&response_type=code\n",
            "\n",
            "Enter your authorization code:\n",
            "··········\n",
            "Mounted at /content/drive\n",
            "Files in Drive:\n",
            "'Colab Notebooks'   Data   Web\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "yKixSq4jotiT",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Working with files\n",
        "# Create directories for the new project\n",
        "!mkdir -p drive/kaggle/talkingdata-adtracking-fraud-detection\n",
        "\n",
        "!mkdir -p drive/kaggle/talkingdata-adtracking-fraud-detection/input/train\n",
        "!mkdir -p drive/kaggle/talkingdata-adtracking-fraud-detection/input/test\n",
        "!mkdir -p drive/kaggle/talkingdata-adtracking-fraud-detection/input/valid\n",
        "\n",
        "# Clone to the folder on google drive to have it after 12 hours\n",
        "%cd drive/kaggle \n",
        "!git clone https://github.com/wxs/keras-mnist-tutorial.git "
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "6SuFUBCSo345",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "# Import modules\n",
        "import imp \n",
        "helper = imp.new_module('helper')\n",
        "exec(open(\"drive/path/to/helper.py\").read(), helper.__dict__)\n",
        "\n",
        "fc_model = imp.new_module('fc_model')\n",
        "exec(open(\"pytorch-challenge/deep-learning-v2-pytorch/intro-to-pytorch/fc_model.py\").read(), fc_model.__dict__)"
      ],
      "execution_count": 0,
      "outputs": []
    }
  ]
}